﻿using Max.PH5_2103A.Shopping.TEntityFrame.Domain;
using Max.PH5_2103A.Shopping.TEntityFrame.DTO;
using Max.PH5_2103A.Shopping.TEntityFrame.IService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Max.PH5_2103A.Shopping.TEntityFrame.API.Controllers.order
{
    /// <summary>
    /// 
    /// </summary>
    [Route("order")]
    [ApiController]
    public class OrderController : BaseController<OrderMasterEntity>
    {
        IOrderMasterService _service;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="service"></param>
        public OrderController(IOrderMasterService service) : base(service)
        {
            _service = service;
        }

        /// <summary>
        /// 创建订单
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("create")]
        public IActionResult Insert(OrderInputDto dto)
        {
            ResponseResultDto response = new();
            response.Code = _service.Insert(dto);

            return Ok(response);
        }
    }
}
